home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 20
/
Cream of the Crop 20 (Terry Blount) (1996).iso
/
program
/
vol15n11.zip
/
REXBOX.ZIP
/
REXXBOX.CMD
< prev
next >
Wrap
OS/2 REXX Batch file
|
1996-02-12
|
40KB
|
1,278 lines
/********************************************************
* REXXBox
* A CD Player for REXX
*
* It supports playplist, pause, resume, track display
* author and title display, error detection
*
* It supports the following command line options
*
* Prints a wide variety of information about the CD.
* 1. The artist and CD title
* 2. The songs on the disc, their length and their order in the playlist
* 3. The current volume, and output type
* 4. A menu of choices during playback
*
* /O for output. Lets you chose how the audio will be heard.
* Possible options are:
* 1. Headphones (front of CD or audio connector)
* 2. Sound card (digital music transfer to your sound card)--CPU intensive!
*
* /P to change a playlist. Allows you to change the order songs are played
*
* /H for help. Will give you help using the REXXbox
*
* /C for color. Turns off colors (ANSI mode). In case you are color blind
* or have a buggy display driver.
*
* /S for quiet. Will display absolutely no instructions. Useful for batch mode
*********************************************************************************/
PlaylistExists = 'FALSE'
volume = 100
outputset = 'FALSE'
outputdir = 'headphones'
env = 'OS2ENVIRONMENT'
ansisupport = 'ON'
animation = 1
delay = 1
SIGNAL ON ERROR /* When commands fail, call "error" routine. */
/* load system utility functions to access ANSI and cursor functions */
call rxfuncadd sysloadfuncs, rexxutil, sysloadfuncs
call rxfuncadd SysTextScreenSize, rexxutil, SysTextScreenSize
call rxfuncadd SysCurPos, rexxutil, SysCurPos
/* Call routine to determine if we are running in a session with ANSI */
/* support (i.e. supports colors, cursor control etc.) */
ansisupport = TestANSI()
if ansisupport = 'ON' then
parse value SysTextScreenSize() with screenrow screencol
parse arg arg1 arg2 arg3 arg4 arg5
/* If the user asks for help, display options and then quit */
If (arg1 = '/?' | arg1 = '/h' | arg1 = '/?') THEN
do
DisplayHelpOptions()
End
Else
Do
verbose = FALSE
output = FALSE
playlistchange = FALSE
End
/* we support up to five simultaneous options -- see DisplayHelpOptions */
rc = ParseArgs(arg1 )
rc = ParseArgs(arg2 )
rc = ParseArgs(arg3 )
rc = ParseArgs(arg4 )
rc = ParseArgs(arg5 )
/* Load multimedia functions */
rc = RXFUNCADD('mciRxInit','MCIAPI','mciRxInit')
InitRC = mciRxInit()
/* Open the CD */
rc = mciRxSendString("open cdaudio alias supercd wait", 'Retst', '0', '0')
/* The following routine makes sure a CD is in the CD-ROM drive */
/* REXXbox can not function without some type of a CD */
rc = EnsureCDInDrive('TRUE')
/* Obtain the unique product ID associated with the CD */
rc = mciRxSendString("info supercd id wait", cdIndentifier, '0', '0')
call sysloadfuncs
/* Get the directory where the REXXBOX.INI file is located */
rc = GetHome()
/* Now, check to see if the product id for this CD is stored in the INI file */
/* If we haven't seen this CD before, we won't have the information in the */
/* INI file */
cdkey = SysIni(mmhome, cdIndentifier, 'Artist')
IF cdkey \= 'ERROR:' THEN
do
/* This CD's description is in the INI file */
/* Find out the number of tracks, artist and title */
NumTracks = SysIni(mmhome, cdIndentifier, 'NumTracks' )
if verbose = 'TRUE' THEN
do
/* Display the information in color if ANSI support is available */
if ansisupport = 'ON' then
do
call charOut , LEFT('Artist is:', 19 ) || "1B"x || "[36;40m" || SysIni(mmhome, cdIndentifier, 'Artist') || "1B"x || "[0m"
say ''
call charOut , LEFT('Title is: ', 19 ) || "1B"x || "[36;40m" || SysIni(mmhome, cdIndentifier, 'Title') || "1B"x || "[0m"
say ''
call charOut , LEFT('Number of tracks:', 19)|| "1B"x || "[36;40m" || NumTracks || "1B"x || "[0m"
say ''
say ''
END
else /* we must display plain/jane text descriptions */
do
say LEFT('Artist is:', 19 ) SysIni(mmhome, cdIndentifier, 'Artist')
say LEFT('Title is: ', 19 ) SysIni(mmhome, cdIndentifier, 'Title')
say LEFT('Number of tracks:', 19) NumTracks
END
END
/* Setup default playlist */
/* The playlist is the order that the music will be played */
/* Unless the user specifies otherwise, we will play it sequentially */
do loop = 0 to NumTracks
Playlist.loop = loop
END
maxnamelen = 0
/* Now, load the names associated with each track on the CD */
/* The user gave us this information the first time the CD was inserted */
do loop = 1 to NumTracks
TrackKey = 'TrackName:' loop
TrackName.loop = SysIni(mmhome, cdIndentifier, TrackKey );
if LENGTH(TrackName.loop ) > maxnamelen THEN
maxnamelen = LENGTH(TrackName.loop )
END
/* Figure out if the caller has a playlist setup */
PlaylistExists = SysIni(mmhome, cdIndentifier, 'Playlist' )
if PlaylistExists = 'ERROR:' THEN
PlaylistExists = FALSE
ELSE
do
NumSongs = SysIni(mmhome, cdIndentifier, 'PlaylistTracks')
/* If the playlist exists, but we can't figure out the number of songs */
/* then, tell the user they have a corrupt REXXBOX.INI file. */
if NumSongs = 'ERROR:' THEN
do
say 'Configuration error--rexxbox.ini is corrupt'
END
ELSE
/* Load the order of the playlist based on the total # of songs */
do loop = 1 to NumSongs
TrackKey = 'PlayTrackName:' loop
Playlist.loop = SysIni(mmhome, cdIndentifier, TrackKey)
END
END
volume = SysIni(mmhome, cdIndentifier, 'Volume' )
/* if there is a bad ini value or if its not there--try to recover */
if volume = 'ERROR:' THEN
volume = 100
/* The user can have the output routed to either:
* the headphones (front panel/audio connector)
* or the sound card (via digital transfer)
*
* Figure out which setting the user chose last time we ran.
*/
outputdir = SysIni(mmhome, cdIndentifier, 'outputdir' )
if outputdir = 'ERROR:' THEN
do
outputdir = 'headphones'
say 'error getting output direction from REXXBOX.INI file'
END
END
ELSE /* We've never seen this CD before--find out artist/title info from user */
do
say 'Unknown CD--which artist recorded this CD?'
pull artist.0
say 'What is the title of the CD?'
pull artist.1
/* Place this information in the REXXBOX.INI file */
iniRc = SysIni(mmhome, cdIndentifier, 'Artist', artist.0 )
iniRc = SysIni(mmhome, cdIndentifier, 'Title', artist.1 )
/* Figure out how many tracks are on the CD */
rc = mciRxSendString("status supercd number of tracks wait", 'NumTracks', '0', '0')
if rc <> 0 THEN
do
say 'error getting number of tracks'
/* Default to 1 track */
iniRc = SysIni(mmhome, cdIndentifier, 'NumTracks', 1 )
END
ELSE
do
/* Save the total number of tracks */
iniRc = SysIni(mmhome, cdIndentifier, 'NumTracks', NumTracks )
maxnamelen = 0
/* Find out the name of each track */
do loop = 1 to NumTracks
say 'Enter name for track: 'loop ': '
pull TrackName.loop
TrackKey = 'TrackName:' loop
iniRc = SysIni(mmhome, cdIndentifier, TrackKey, TrackName.loop )
if LENGTH(TrackName.loop ) > maxnamelen THEN
maxnamelen = LENGTH(TrackName.loop )
END
END
/* Indicate that we haven't create